<template>
  <div id="consultation_orderdetails">
    <header>
      <i @click="goBack()"></i>
      <div>会诊详情</div>
    </header>
    <div class="border-8"></div>
    <ul>
      <li>
        <a>
          姓名:
          <input type="text" v-model="obj.doctorname" placeholder="请输入真实姓名" required @focus='$utils.focus($event)' disabled/>
        </a>
      </li>
      <li>
        <a>
          手机号:
          <input type="text" v-model="obj.tel" placeholder="请输入手机号" required @focus='$utils.focus($event)' disabled/>
        </a>
      </li>
      <li class="auto">
        <a>
          <b>问题描述</b>
          <ul>
            <li>
              口腔卫生:{{obj.mouth}}
            </li>
            <li>龋齿:{{obj.quchi}}</li>
            <li>牙周病:{{obj.yazhou}} </li>
            <li>畸形中央尖:{{obj.jixing}}</li>
            <li>弹响:{{obj.tanxiang}}</li>
            <li>疼痛:{{obj.pain}}</li>
            <li>开口型:{{obj.kaikou}}</li>
            <li>弹口度{{obj.zhangkou}}指</li>
          </ul>
        </a>
      </li>
      <li style="padding-left: 10px;">
        <a style="margin: 0 5px;line-height: 0px;border-bottom:0px">
          <b>相关图片</b>
        </a>
            <img v-for='(item,index) in relPic' :src=item alt="" style="width:0.42rem;height:0.42rem;margin:2px 5px;">
      </li>
      <li>
        <a>
          <b>选择医生</b>
        </a>
      </li>
      <li v-for='(item,index) in expertArr' :key='index'>
        <a>
          {{item.name}}:
          <input type="text" v-model="item.content" placeholder="专家简介" required @focus='$utils.focus($event)' disabled/>
        </a>
      </li>
      <li class='border-6'>
        <a>
          创建时间:
          <input type="text" v-model="obj.time" placeholder="创建时间" required @focus='$utils.focus($event)' disabled/>
        </a>
      </li>
      <li>
        <a>
          订单状态:
          <input class='active' type="text" v-model="statusObj[obj.status]" placeholder="订单状态" required @focus='$utils.focus($event)'
            disabled/>
        </a>
      </li>
      <li class='noborder'>
        <a>
          订单号:
          <input type="text" v-model="obj.order_num" placeholder="订单号" required @focus='$utils.focus($event)' disabled/>
        </a>
      </li>
    </ul>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        status: 'add', //是查看还是编辑
        relPic: [],
        expertArr: [],
        obj: {
          mouth: "",
          quchi: "",
          jixing: "",
          yazhou: "",
          tanxiang: "",
          pain: "",
          kaikou: "",
          zhangkou: "", //会诊详情对象
          time: '',
          status: '',
          order_num: '',
          doctorname: '',
          tel: ''


        },
        statusObj: {
          pay: '已付款',
          unpay: '待付款',
          will_finish: '待收货',
          finish: '已完成',
          will_cancel: '待撤销',
          cancel: '已撤销',
          will_refund: '待退款',
          refund: '已退款',
        },



      }
    },
    components: {},
    methods: {
      goBack() {
        this.$router.back();
      },
      getExpertByEid(eid) {
        this.$api.get(this.$api.baseURLSchool, "select_cid/expert/" + eid, {}, r => {
          if (r.data.ret == 1) {
            this.expertArr.push(r.data.info);
          }
        }, err => {
          console.log(err);
        })
      },
      // 初始化
      init() {
        if (this.$route.query.id) {
          this.obj.id = this.$route.query.id;
          this.$api.get(this.$api.baseURLSchool, "select_cid/doc_consultation/" + this.obj.id, {}, r => {
            if (r.data.ret == 1) {
              this.obj = JSON.parse(r.data.info.problem);
              this.relPic = JSON.parse(r.data.info.relPic)[0];
              this.obj.time = r.data.info.time
              this.obj.doctorname = r.data.info.doctorname
              this.obj.tel = r.data.info.tel
              this.obj.status = r.data.info.status
              this.obj.order_num = r.data.info.order_num
              const expertArr = JSON.parse(r.data.info.expertArr);
              expertArr.forEach((item, index) => {
                this.getExpertByEid(item);
              });
            }
          }, err => {
            console.log(err);
          })
        }
      },

    },
    created() {
      this.init();
    },
    mounted() {}
  }

</script>
<style lang="scss" scoped>


</style>
